#include <my_header.h>
#include"threadPool.h"
#include"taskQueue.h"
int main(int argc, char *argv[]){                                  
    
    // ./server ip port 子线程数
    ARGS_CHECK(argc,4);
    
    threadPool_t threadPool;//申请一块内存
    threadPoolInit(&threadPool,atoi(argv[3]));//申请完了初始化一下
    //初始完了线程池，可以创建工人线程
    makeWorker(&threadPool);
    
    int sockfd = tcpInit(argv[1],argv[2]);

    int epfd = epoll_create(1);
    epollAdd(epfd,sockfd);//将sockfd加入监听

    while(1){
        struct epoll_event readyset[1024];
        int readyNum = epoll_wait(epfd,readyset,1024,-1);
        for(int i = 0;i<readyNum;i++){
            if(readyset[i].data.fd == sockfd){
                int netfd = accept(sockfd,NULL,NULL);
                printf("i get 1 task\n");
            }
        }
    }
    return 0;
}

